package com.dao;

import com.entity.Favorite;
import com.pojo.Favorites;

import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @program: ssm
 * @description: 收藏
 * @author: zl
 * @create: 2022-05-17 21:23
 **/

public interface FavoriteMapper  {
    @Select("select f.fid,f.user_id,f.good_name,f.shop_id,f.good_id,g.good_id,g.price,g.g_image from favorites as f left join goods as g\r\n"
    		+ "    		on f.good_id=g.good_id WHERE f.user_id=#{user_id}")
    List<Favorites> selectALl(@Param("user_id") int user_id);


    @Delete("delete from favorites where fid=#{fid}")
    public  int deleteFavorite(@Param("fid") int fid);

    
    @Insert("insert into favorites(user_id,good_name,shop_id,good_id)\n" +
            "        values (#{user_id}, #{good_name}, #{shop_id}, #{good_id})")
    int addFavorite(Favorite favorite);
}
